The UDP_Send and UDP_Receive are just simple examples of
setting up a UDP socket and sending and receiving data. UDP_Chat is a 
IRC-like chat program that both sends and receives (it is a test bed
for internet game communications). All programs open UDP sockets 
(domain AF_INET, and type of SOCK_DRAM). The Send and Receive progs
and the earlier versions of UDP_Chat are in the Old_Stuff directory, so
you can start out with the simpler programs first, if you find the
lastest version of UDP_Chat a bit daunting :-)

   The first Send program (UDP_Send) just simply sends each 
packet to the host address and port defined at the top of the program 
(this could be different for every data packet). UDP_Receive binds it's 
socket with bind_() to localhost at the port defined at the top of the 
program (this port can't have an entry in Services though). Then it 
just checks if any data is waiting on the socket and gets it.

   The second Send program (UDP_Send2) does things slightly 
differently. It opens a socket and then does a connect_() to the port 
on the appropriate host (defined at the top of the program). Then it 
just uses send_() like in TCP, and all packets will be sent to the 
connected socket. UDP_Receive2 does the same as UDP_Receive, and binds 
the socket to the port, but because there's a TCP-like connection to 
the sending host, it just uses recv_() to receive data.

   Just run UDP_Send and UDP_Receive (or UDP_Send2 and UDP_Receive2), 
and type some letters into the Send window and hit return, and they 
will appear in the receive window. To close the programs, hit the close 
button in their window. Note: UDP_Send works with UDP_Receive2, and 
vice-versa! 

UDP_Send-and-UDP_Receive
Converted with g2h, © 24.06.1998 N. DARNIS